//
//  MyTrainViewController.m
//  TeamInformatization
//
//  Created by bigger on 2019/4/2.
//  Copyright © 2019年 SPIC. All rights reserved.
//

#import "MyTrainViewController.h"
#import "CommonSmallViewCell.h"

@interface MyTrainViewController ()<UITableViewDelegate, UITableViewDataSource, ChangeContentViewDelegate>

@property (nonatomic, strong) UITableView *trainListTableView;

// data
@property (nonatomic, strong) NSMutableArray *trainListArray;

@end

@implementation MyTrainViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    [self showTitleBarWithTitle:@"我的培训" leftButtonStyle:Base_NavigationBar_Back rightButtonStyle:Base_NavigationBar_None];
    // 初始化
    self.trainListArray = [NSMutableArray arrayWithCapacity:0];
    
    // UI
    [self loadShowViews];
}

// UI
- (void)loadShowViews
{
    ChangeContentView *changeContentView = [[ChangeContentView alloc] initWithFrame:CGRectMake(0, kSafeAreaTopHeight, kScreenWidth, 40 * kScaleWidth) TitleArray:@[@"我的培训", @"发起的培训"]];
    changeContentView.delegate = self;
    [self.view addSubview:changeContentView];
    
    self.trainListTableView = [[UITableView alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(changeContentView.frame), kScreenWidth, kSecondContentHeight - 40 * kScaleWidth) style:UITableViewStylePlain];
    [_trainListTableView registerClass:[CommonSmallViewCell class] forCellReuseIdentifier:@"CommonSmall"];
    _trainListTableView.delegate = self;
    _trainListTableView.dataSource = self;
    _trainListTableView.backgroundColor = [UIColor clearColor];
    _trainListTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    _trainListTableView.showsVerticalScrollIndicator = NO;
    [self.view addSubview:_trainListTableView];
    
}


#pragma mark - ChangeContentViewDelegate
- (void)getTouchNum:(int)touchNum withChangeContentView:(ChangeContentView *)changeContentView
{
    switch (touchNum) {
        case 0: {
            
            break;
        }
        case 1: {
            
            break;
        }
        default:
            break;
    }
}

#pragma mark - TableViewDelegate/DataSource
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return _trainListArray.count;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 50 * kScaleWidth;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    
    //    CommonMessage *commonMessage = [[CommonMessage alloc] init];
    //    if (_meetingListArray.count != 0) {
    //        commonMessage = self.meetingListArray[indexPath.row];
    //    }
    
    CommonSmallViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"CommonSmall" forIndexPath:indexPath];
    if (!cell) {
        cell = [[CommonSmallViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"CommonSmall"];
    }
    
    //    [cell setShowCellWithCommonMessage:commonMessage];
    
    return cell;
    
    
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    
}
#pragma -导航栏 两边按钮操作
-(void)baseNavigationBarLeftButtonClick:(UIButton *)button
{
    [self.navigationController popViewControllerAnimated:YES];
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
